#ifndef EDITMENU_H
#define EDITMENU_H

#include "Entity/DictData.h"
#include "router/systemManager/menuManager/icondialog.h"
#include <QDialog>
#include <QTableWidget>
#include <QTreeWidget>
#include <api/systemManager/menumanagerapi.h>

namespace Ui {
class EditMenu;
}

class EditMenu : public QDialog
{
    Q_OBJECT

public:
    explicit EditMenu(QList<DictData> sys_show_hide,QString menuName = "",qlonglong menuId = 0,
                      bool flag = 0,QWidget *parent = nullptr);
    ~EditMenu();

signals:
    void success();

protected:
    bool eventFilter(QObject *obj, QEvent *event);

private slots:
    void on_btn_cancel_clicked();

    void on_btn_ok_clicked();

    void on_lineEdit_parentManu_textChanged(const QString &arg1);

    void on_radioButton_directory_clicked();

    void on_radioButton_menu_clicked();

    void on_radioButton_btn_clicked();

private:
    Ui::EditMenu *ui;
    QList<DictData> sys_show_hide;
    QTreeWidget *tree;
    IconDialog *iconDialog;
    MenuManagerApi menuManagerApi;
    QList<Menu> menuList;
    Utils utils;
    Menu menu;
    bool flag;

    bool event(QEvent *event);
    void init();
    void getList();
    void initTree();
    void setChildTree(QTreeWidgetItem *item);
    void setTreeChildCount(QTreeWidgetItem *item);
    bool inputCheck();
};

#endif // EDITMENU_H
